package com.wuqi.dev.ipcdemo;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by Risky57 on 2017/5/9.
 */

public class AIDLService extends Service {
    @Nullable
    @Override
    public IBinder onBind (Intent intent) {
        return new ServiceBinder();
    }

    public class ServiceBinder extends IMyAidlInterface.Stub{

        @Override
        public int add (int a, int b) throws RemoteException {
            return a + b;
        }

        @Override
        public void sendUrl (String url) throws RemoteException {
            // TODO: 2017/5/9 通过url下载数据
            Log.d("ServiceBinder", url);
        }

        @Override
        public void sendUser (UserBean user) throws RemoteException {
            Log.d("ServiceBinder", "user:" + user);
        }
    }
}
